#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author:Taotie Ren

# mapIt.py - Launches a map in the browser using an address from the command line or clipboard.

# import logging

# 禁用日志模块
# logging.disable(logging.CRITICAL)
# logging.basicConfig(level=logging.DEBUG, format=' %(asctime)s - %(levelname)s - %(message)s')

# https://www.amap.com/place/BS11286666
# https://www.amap.com/search?query=体育西路(地铁站)&city=440100&geoobj=113.311961%7C23.127245%7C113.357231%7C23.149157&zoom=15.45

import webbrowser, sys, pyperclip

if len(sys.argv) > 1:
	# Get address from command line.
	address = ' '.join(sys.argv[1:])
else:
	#  Get address from clipboard.
	address = pyperclip.paste()

# webbrowser.open('https://www.amap.com/place/' + address)
webbrowser.open(
	'https://www.amap.com/search?query=' + address + '&city=440100&geoobj=113.311961%7C23.127245%7C113.357231%7C23.149157&zoom=15.45')
